#include "Device/IndependentKeybord.h"
#include "Hardware/Timer.h"

#define IndkeyPort P3

char code IndKeyTable[]={'a','b','c','d'};

enum INDKEYSTATUS
{
	PRESS=0, //按下
	POPUP    //弹起
};

char GetIndKeyPress()
{
	uint8 i;
	for(i=0;i<4;++i)
	{
		if(GetBit(IndkeyPort,i)==PRESS)
		{
			Delay(7);
			if(GetBit(IndkeyPort,i)==PRESS)   //消除抖动
			{
				while(GetBit(IndkeyPort,i)==PRESS);
				return IndKeyTable[i];
			}
		}
	}
	return 0;
}